<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      input {
        width: 200px;
        height: 200px;
        font-size: 60px;
        font-weight: 700;
        margin: auto;
      }
    </style>
  </head>
  <body>
    <input type="button" value="0" id="input" />
  </body>
  <script>
    function w() {
      var input = document.getElementById("input");
      var i = 0;
      input.onclick = function () {
        alert(++i);
        input.value = i;
      };
    }
    w();
  </script>
</html>
